<template>
   <div>
    <docinfo :empno="empno"/>
    <el-collapse accordion>
      <el-collapse-item :title="p.workDateString+'【'+(p.workTime==1?'上午':'下午')+'】'"
           :name="p.id" v-for="p in plans" :key="p.id" >
        <div class="link">
          <b>放号总数:{{p.planCount}}</b>
          <b>已挂号人数:{{p.bookCount}}</b>
          <b>可挂号数:{{p.planCount-p.bookCount}}</b>
          <b>诊室:{{p.room}}</b>
          <b>挂号费:{{p.fee}}</b>
          <b>状态:{{p.state==1?'正常':'取消'}}</b>

          <div class="btn_doc" style="margin-top:0px" v-if="(p.planCount-p.bookCount)>0">
           <router-link :to="{path:'/book',query:{planid:p.id}}" > 
              <el-button type="success" round size="small">挂号</el-button>
           </router-link>
          </div>
        </div>
        <div class="txt">
          如果安排有变化，可以提前1天拨打112233取消预定
        </div>
      </el-collapse-item>
    </el-collapse>
    </div>
</template>

<script>
import { useRoute,useRouter } from 'vue-router'
import docinfo from '@/components/docInfo.vue'
export default {
   inject:["global"],
   data(){
       return{
           plans:[],
           empno:useRoute().query.empno
       }
   },
   mounted:function(){
       //this.empno=route.query.empno;
       const axios=this.global.axios;
       axios.get("http://192.168.2.5:9000/hp/order/plan/findbydoc?empno="+this.empno)
       .then(resp=>{
           this.plans=resp.data.obj;
       })
   },
   components:{docinfo:docinfo}
}
</script>

<style scoped>
   .txt,.link{text-align: left;}
   .btn_doc{float:right}
</style>